<template>
  <div class="dataAllContainer">
    <div class="leftContainer">
      <div class="title">筛选器</div>
      <div
        id="main"
        style="height: calc(100vh - 100px); width: 500px; overflow-y: scroll"
      >
        <el-tree
          :data="data"
          highlight-current
          :props="defaultProps"
          @node-click="handleNodeClick"
        ></el-tree>
      </div>
    </div>
    <div class="centerContainer"></div>
    <div class="rightContainer">
      <div class="title">报警列表</div>
      <div
        id="main"
        style="
          height: calc(100vh - 105px);
          overflow-y: scroll;
          overflow-x: hidden;
        "
      >
        <el-row :gutter="20">
          <el-col
            :span="6"
            v-for="item in tableData"
            :key="item.id"
            style="margin-bottom: 5px"
          >
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <span>类型：{{ item.type === 0 ? "非紧急" : "紧急" }}</span>
                <!-- <el-button style="float: right; padding: 3px 0" type="text"
                  >取消预警</el-button
                > -->
              </div>
              <div>状态：{{ item.type === 0 ? "未处理" : "已处理" }}</div>
              <div>报警信息：{{ item.message }}</div>
              <!-- <div>型号：{{  }}</div> -->
              <div>地址：{{ item.address }}</div>
              <div>仓序列号：{{ item.actionNo }}</div>
              <div>提交时间：{{ item.operateTime }}</div>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import { addressList, warningList } from "@/api/index.js";
export default {
  name: "DataAll",
  data() {
    return {
      data: [],
      defaultProps: {
        children: "children",
        label: "name",
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
    };
  },
  props: {
    prop: {
      type: String,
      required: false,
    },
  },
  components: {},
  computed: {},
  watch: {},
  methods: {
    handleNodeClick(data) {
      console.log(data);
      this.getwarningList(data.id);
    },
    getList() {
      addressList({}).then((res) => {
        this.data = res;
      });
    },
    getwarningList(data) {
      warningList(data).then((res) => {
        this.tableData = res;
      });
    },
  },
  created() {},
  mounted() {
    this.getList();
    this.getwarningList(0);
  },
  updated() {},
  destroyed() {},
  filters: {},
};
</script>

<style scoped lang="scss">
.dataAllContainer {
  display: flex;
  .title {
    color: #fff;
    text-align: center;
  }
  #main {
    border: 2px solid #003a78;
    border-radius: 5px;
    padding: 5px;
    background-color: #fff;
  }
  .leftContainer {
    width: 500px;
    margin-right: 10px;
    margin-left: 5px;
  }
  .rightContainer {
    width: calc(100vw - 520px);
  }
}
</style>
